package czk.jvm.lecture.classloader;

public class MyTest17 {
    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        MyTest16 loader1=new MyTest16("loader1");
        loader1.setPath("E:\\");
        Class<?> aClass = loader1.loadClass("czk.jvm.lecture.classloader.MySample");
        System.out.println(aClass.hashCode());
        //会调用MySample类的构造方法
        //如果不调用，则不会对mycat进行主动使用，则不一定会加载Mycat.class
        //以为jvm规范规定jvm可以预料某个类将会被使用而加载该类的class文件
        System.out.println(MyCat.class.getClassLoader());
        Object object = aClass.newInstance();
        System.out.println(object);
    }
}
